package com.digitalchina.lxnsy.viewholder;

import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.TechnologiesVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.digitalchina.lxnsy.toolkit.StringUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/1/12 11:45:58
 * 修改备注：
 * ================================================
 */

public class TechnologiesListHolder extends BaseViewHolder<TechnologiesVO> {

    private SimpleDraweeView idvImage;//图片
    private TextView tvTitle;//标题
    private TextView tvContent;//内容
    private TextView tvTime;//日期
    private TextView tvPageView;//浏览数


    public TechnologiesListHolder(ViewGroup parent) {
        super(parent, R.layout.item_technologies_list);

        idvImage = $(R.id.sdv_image);
        tvTitle = $(R.id.tv_title);
        tvContent = $(R.id.tv_content);
        tvTime = $(R.id.tv_time);
        tvPageView = $(R.id.tv_pageView);
    }

    @Override
    public void setData(final TechnologiesVO data) {
        super.setData(data);

        FrescoUtil.showImageSmall(data.getImg(), idvImage);
        tvTitle.setText(data.getTitle() != null ? data.getTitle() : "");


        tvContent.setText(data.getContent() != null ? StringUtil.stripHtml(data.getContent()) : "点击查看详情");
        tvTime.setText(data.getCreateTime() != null ? data.getCreateTime() : "");
        tvPageView.setText(data.getPageViewNums() != null ? data.getPageViewNums() + "浏览" : "0浏览");

    }

}
